% # File Info -- stSpec.sty, Part of SDUSThesis package, layout settings.

% Version Control System Information -- Subversion, hosts on <+Google Code+>;
% FileID		$Id$;
% FileDate		$Date$;
% FileRevision	$Revision$

% # Copyright (C) 2009-2012, LiTuX, All wrongs reserved.
%
%	Permission is granted to copy, distribute and/or modify this document
%	under the terms of the GNU Free Documentation License, Version 1.3
%	or any later version published by the Free Software Foundation;
%	with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
%	A copy of the license is included in the section entitled "GNU
%	Free Documentation License".
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{stSpec}[2012/3/17 v0.2 SDUST-Thesis Specification by LiTuX]
\RequirePackage{ifthen}
\RequirePackage{etoolbox}
\RequirePackage{ifxetex}
\RequirePackage{xstring}
\RequirePackage{hyperref}
% \RequirePackage{times}
% \RequirePackage{titlesec, titletoc} % TODO
\RequirePackage{graphicx}

\ifthenelse{\boolean{xetex}}{\def\zhclen{1}}{\def\zhclen{3}}

%%%%%%%%%%%%%%%%%%%%%%%  Settings: %%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{fancyhdr}
\pagestyle{fancy}
	\fancyhf{}% clear all header and footer fields
	\fancyhead[LO, RE]{\small\schoolName\@degreeLevel{}论文}%
	\fancyhead[RO, LE]{\small\leftmark}%
	\fancyfoot[C]{\small\thepage}%

\fancypagestyle{headings}{%
	\fancyhf{}% clear all header and footer fields
	\fancyhead[LO, RE]{\small\schoolName\@degreeLevel{}论文}%
	\fancyhead[RO, LE]{\small\leftmark}%
}

\fancypagestyle{plain}{%
	\pagestyle{fancy}%
}
% \fancypagestyle{plain}{%
% 	\fancyhf{}% clear all header and footer fields
% 	\fancyhead[L]{\small\schoolName\@degreeLevel{}论文}%
% 	\fancyhead[R]{\small\leftmark}%
% 	\fancyfoot[C]{\small\thepage}%
% }

\CTEXsetup[beforeskip=10pt]{chapter}
\CTEXsetup[afterskip=15pt]{chapter}
\CTEXsetup[name={,}]{chapter}
\CTEXsetup[number=\arabic{chapter}]{chapter}
% \CTEXsetup[nameformat={\ziju{1}\zihao{-2}\songti\bfseries}]{chapter}
% \CTEXoptions[contentsname={目录}]

%%%%%%%%%%%%%%%%%%%%%%% Definition %%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\connSep}{：\kern-0.2em}
\newcommand{\classNoName}{分类号}
\newcommand{\secTypeName}{密级}
\newcommand{\UDCName}{U~D~C}
\newcommand{\orgNoName}{单位代码}
\newcommand{\thesisType}{学位论文}
\newcommand{\schoolName}{山东科技大学}
\newcommand{\degreeLevelName}{申请学位级别}
\newcommand{\majorName}{专业名称}
\newcommand{\supervisorName}{指导教师姓名}
\newcommand{\profTitleName}{职称}
\newcommand{\titleName}{论文题目}
\newcommand{\authorName}{作者姓名}
\newcommand{\superName}{指导教师}
\newcommand{\fieldName}{研究方向}
\newcommand{\enrollDate}{入学时间}
\newcommand{\submitDate}{论文提交日期}
\newcommand{\defenseDate}{论文答辩日期}
\newcommand{\awardDate}{授予学位日期}
\newcommand{\zhAbstractName}{摘要}
\newcommand{\enAbstractName}{Abstract}

\newcommand{\affirmationName}{声明}
\newcommand{\affirmationNameEn}{Affirmation}
\newcommand{\zhKeywordName}{关键词}
\newcommand{\enKeywordName}{Keywords}

\newcommand{\schoolNameEn}{Shandong University of Science and Technology}
\newcommand{\superNameEn}{Supervisor}

\newlength{\tinfolen}
\setlength{\tinfolen}{4em}


%%%%%%%%%%%%%%%%%%%%%%% Commands %%%%%%%%%%%%%%%%%%%%%%%
% SDUS{\sffamily T}{\scshape hesis}%
\newcommand{\SDUSThesis}{%
	{\scshape SDUSThesis}%
}
% \newcommand{\expand}[2][4em]{\makebox[#1][s]{#2}}
% \newcommand{\cexpand}[2][4em]{%
% \makebox[#1][s]{\hspace*{\fill}#2\hspace*{\fill}}}
\newcommand{\expand}[2][4em]{\begin{CJKfilltwosides}{#1}%
#2\end{CJKfilltwosides}}
\newcommand{\cexpand}[2][4em]{\begin{CJKfilltwosides}{#1}%
\hfill#2\hfill\end{CJKfilltwosides}}

\renewcommand{\author}[2][]{%
   \def\zh@author{#2}%
   \ifthenelse{\equal{#1}{}}{%
      \def\en@author{#2}%
   }{%
      \def\en@author{#1}%
   }%
}

\renewcommand{\title}[2][]{%
   \def\zh@title{#2}%
   \ifthenelse{\equal{#1}{}}{%
      \def\en@title{#2}%
   }{%
      \def\en@title{#1}%
   }%
}

\newcommand{\cNumber}[1]{%
   \CTEXnumber{\@tmpVar}{#1}\@tmpVar%
}
\newcommand{\cDigit}[1]{%
   \CTEXdigits{\@tmpVar}{#1}\@tmpVar%
}

\newcommand{\formatsetting}[1]{%
   \IfStrEqCase{#1}{%
      {short}{\def\format{short}}%
      {long}{\def\format{long}}%
      {big}{\def\type{big}}%
      {small}{\def\type{small}}%
      {old}{\def\type{old}}%
   }[\ClassWarning{SDUSThesis}{Unknown argument: `#1'}]%
}

\newcommand{\strParse}[1]{%
   \def\strParseFlag{0}% 0 is OK
   \StrSubstitute{#1}{/}{.}[\dateStr]%
   \StrSubstitute{\dateStr}{-}{.}[\dateStr]%
   \StrCount{\dateStr}{.}[\dotNum]% how many dots
   \IfEqCase{\dotNum}{% cases of dots
      {2}{% 2011.12.31 like
         \def\dateformat{long}%
         \StrBefore{\dateStr}{.}[\theYear]%
         \StrBetween[1, 2]{\dateStr}{.}{.}[\theMonth]%
         \StrBehind[2]{\dateStr}{.}[\theDay]%
      }{1}{% 2011.12 like, `long` will not support
         \def\dateformat{short}%
         \StrBefore{\dateStr}{.}[\theYear]%
         \StrBehind{\dateStr}{.}[\theMonth]%
      }% cases
   }[% default, wrong string
   % \def\dateformat{wrong}%
   \def\strParseFlag{1}% 0 is OK, 1 is error
   % \ClassWarning{SDUSThesis}{Unrecognized date.}%
   % \def\theYear{\the\year}%
   % \def\theMonth{\the\month}%
   % \def\theDay{\the\day}%
   ]% end case
}

\newcommand{\convertDate}[4][short, small]{% default is small short
%%%%%%%%%%%%%%% |#1|, |#2|, |#3|, |#4|: 
   \def\format{short}% default
   \def\type{small}% default
   \StrDel{#1}{ }[\formats]%
   \StrCount{\formats}{,}[\commaNum]%
   \IfEqCase{\commaNum}{% cases of commas, format settings
      {1}{% short, small like
         \StrBefore{\formats}{,}[\parta]%
         \StrBehind{\formats}{,}[\partb]%
         \formatsetting{\parta}%
         \formatsetting{\partb}%
      }{0}{% short like, or small like
         \formatsetting{\formats}%
      }% cases
   }[% default, wrong string
      \ClassWarning{SDUSThesis}{Wrong arguments: `\formats'}%
   ]% end case.
   \ifthenelse{\equal{#4}{}}{\def\format{short}}{}%
   \IfStrEqCase{\type}{% for different types
      {big}{% Chinese big
         \cDigit{#2}年\cNumber{#3}月%
         \IfStrEq{\format}{long}{\cNumber{#4}日}{}%
      }{small}{% Chinese small, with numbers
         #2 年{} #3 月%
         \IfStrEq{\format}{long}{ #4 日}{}%
      }% cases
   }[% fallback to old
      \ifcase#3\or January\or February\or March\or April\or May\or June\or
      July\or August\or September\or October\or November\or December\fi%
      \IfStrEq{\format}{long}{ #4}{}%
      , #2%
   ]% end cases
}

\newcommand{\showDate}[2][short, small]{% default is small short.
   \strParse{#2}% Get the date value
   \ifthenelse{\strParseFlag=1}{% unrecognized string
      \ClassWarning{SDUSThesis}{Unrecognized date, use it directly.}%
      #2% show the string directly.
   }{% else, convert it.
      \IfStrEq{\dateformat}{short}{%
         \convertDate[#1]{\theYear}{\theMonth}{}%
      }{%
         \convertDate[#1]{\theYear}{\theMonth}{\theDay}%
      }% end short
   }% end wrong
}

\renewcommand{\date}[1]{
   \def\submit@date{#1}%
   \strParse{#1}% Get the date value
   \ifthenelse{\strParseFlag=1}{% unrecognized
      \ClassWarning{SDUSThesis}{Unrecognized date, use `\protect\today'.}%
      \edef\submit@year{\the\year}%
      \edef\submit@month{\the\month}%
      \edef\submit@day{\the\day}%
   }{% else
      \edef\submit@year{\theYear}%
      \edef\submit@month{\theMonth}%
      \IfStrEq{\dateformat}{short}{% If short, day may be unused
         \edef\submit@day{1}% use 1st of the month
      }{% long, use the day value.
         \edef\submit@day{\theDay}%
      }% end short test.
   }% end wrong
   \edef\default@enroll{\number\numexpr\submit@year-3\relax}% default setting.
   \ifthenelse{\submit@year=\the\year}{}{%
      \ClassWarning{SDUSThesis}{Are you sure it's \submit@year
      but not \the\year?}%
   }% end check value
}

\newcommand{\useDate}[1]{%
   \convertDate[#1]{\submit@year}{\submit@month}{\submit@day}%
}

\newcommand{\maxwide}[2]{%
   \StrLen{#1}[\llen]%
   \StrLen{#2}[\rlen]%
   %%%%%%%% left: \llen, right: \rlen.
   \ifthenelse{\llen>\rlen}{% left is longer
      \def\thewide{\number\numexpr\llen/\zhclen}%
   }{% right is longer
      \def\thewide{\number\numexpr\rlen/\zhclen}%
   }% end ifthen
}

\newcommand{\checkwide}[1]{%
   \ifthenelse{\thewide<4}{% too short
      \def\thewide{4}% use 4 as minimum
   }{% else
      \ifthenelse{\thewide>7}{% too long
         \ClassWarning{SDUSThesis}{Fixme: string too long to adjust.}%
      }{}% end 7 test
   }% end 4 test
}

\newcommand{\strDiv}[1]{%
   %%%%%%% input #1, |\meaning#1|:\\
   \saveexpandmode\expandarg% change mode
   \IfSubStr*{#1}{\string\\}{% `\\' force break
      %%%%%%% found;
      \StrDel{#1}{ }[\nospacestr]% remove spaces
      \StrBefore*{\nospacestr}{\string\\}[\lpart]% left part
      \StrBehind*{\nospacestr}{\string\\}[\rpart]% right part
      \maxwide{\lpart}{\rpart}%
      \checkwide{\thewide}% wide result
      \def\lines{2}% linebreak flag
   }{% no `\\' force break
      \StrCount{#1}{ }[\spcount]% check how many spaces
      \ifthenelse{\spcount=1}{% only one space, treat as line break
         %%%%%%% space separate;
         \StrBefore{#1}{ }[\lpart]% left part
         \StrBehind{#1}{ }[\rpart]% right part
         \maxwide{\lpart}{\rpart}%
         \checkwide{\thewide}% wide result
         \def\lines{2}% linebreak flag
      }{% more than one, or none, ignore them.
         \StrDel{#1}{ }[\nospacestr]% remove spaces
         \StrLen{\nospacestr}[\slen]% whole length
         \def\thelen{\number\numexpr\slen/\zhclen\relax}% convert
         % \def\testnum{\number\numexpr\slen/\zhclen/2\relax}
         %%%%%%%%%%%% not found, |\meaning\nospacestr|, \slen/\zhclen, \thelen;
         \ifthenelse{\thelen<4}{% too short, do not break
            \def\lines{1}% only one line
            \def\thewide{4}% 4 is the minimum
         }{% > 4
            \ifthenelse{\thelen>7}{% long, break in the middle
               \def\thewide{\number\numexpr\thelen/2\relax}%
               \StrSplit{\nospacestr}{\numexpr\thewide*\zhclen\relax}{\lpart}{\rpart}% split
               \checkwide{\thewide}%
               \def\lines{2}% linebreak flag
            }{% 4 \to 7, use the length as wide value
               \def\lines{1}%
               \edef\thewide{\thelen}%
            }% end 7
         }% end 4
      }% end space test
   }% end `\\' test.
   %%%%%%%% \fbox{\lpart}\fbox{\rpart}\\
   %%%%%% |\meaning\lpart|\StrLen{\lpart}, |\meaning\rpart|\StrLen{\rpart}.
   \restoreexpandmode%
}

\newcommand{\aexpand}[1]{%
   % \def\stringin{#1}%
   % \strDiv{\stringin}%
   \strDiv{#1}%
   %%%%%%%%%%%% wide: \thewide.
   \ifthenelse{\lines=2}{% have line break
      \begin{minipage}[t]{\thewide\ccwd}
         \underline{\cexpand[\thewide\ccwd]{\lpart}}\\
         \underline{\cexpand[\thewide\ccwd]{\rpart}}
      \end{minipage}
   }{% only one line
      \underline{\cexpand[\thewide\ccwd]{\nospacestr}}
   }% end ifthen
}

\newcommand{\classNo}[1]{%
\ifthenelse{ \equal{#1}{} }%
	{\def\@classNo{\space}}%
	{\def\@classNo{#1}}%
}
\newcommand{\secType}[1]{%
\ifthenelse{ \equal{#1}{} }%
	{\def\@secType{\space}}%
	{\def\@secType{#1}}%
}
\newcommand{\UDC}[1]{%
\ifthenelse{ \equal{#1}{} }%
	{\def\@UDC{\space}}%
	{\def\@UDC{#1}}%
}
\newcommand{\orgNo}[1]{%
\ifthenelse{ \equal{#1}{} }%
	{\def\@orgNo{\space}}%
	{\def\@orgNo{#1}}%
}

\newcommand{\degree}[2]{%
\ifthenelse{ \equal{#1}{} }%
	{\def\type@degree{\space}}%
	{\def\type@degree{#1}}%
\ifthenelse{ \equal{#2}{} }%
	{\def\@degreeLevel{\space}}%
	{\def\@degreeLevel{#2}}%
}

\newcommand{\college}[2]{%
   \ifthenelse{\equal{#1}{}}{%
      \def\zh@college{\space}}{%
      \def\zh@college{#1}%
   }%
   \ifthenelse{\equal{#2}{}}%
      {\def\en@college{\space}}%
      {\def\en@college{#2}}%
}


\newcommand{\major}[1]{%
   \def\input@major{#1}%
   \strDiv{\input@major}%
   \edef\majorWidth{\expandonce{\thewide}}%
   \edef\majorBreak{\expandonce{\lines}}%
   \ifthenelse{\lines=2}{%
      \edef\l@major{\expandonce{\lpart}}\edef\r@major{\expandonce{\rpart}}%
   }{%
      \edef\@major{\expandonce{\nospacestr}}%
   }% end ifthen
}
\newcommand{\supervisor}[2][]{%
   \ifthenelse{\equal{#2}{}}{%
      \def\zh@supervisor{\space}%
   }{%
      \def\zh@supervisor{#2}%
   }%
   \ifthenelse{\equal{#1}{}}%
      {\def\en@supervisor{#2}}%
      {\def\en@supervisor{#1}}%
   \def\supervisorList{%
      \underline{\cexpand[\majorWidth\ccwd]{\zh@supervisor}}%
   }%
}
\newcommand{\ptitle}[2]{%
   \ifthenelse{\equal{#1}{}}{%
      \def\zh@ptitle{\space}}{%
      \def\zh@ptitle{#1}%
   }%
   \ifthenelse{\equal{#2}{}}%
      {\def\en@ptitle{\space}}%
      {\def\en@ptitle{#2}}%
   \def\personTitleList{%
      \underline{\cexpand[\rightWidth\ccwd]{\zh@ptitle}}%
   }%
}

% an ugly command:
\newcommand{\advisor}[2]{%
   \appto{\supervisorList}{%
      \\\underline{\cexpand[\majorWidth\ccwd]{#1}}%
   }%
   \appto{\personTitleList}{%
      \\\underline{\cexpand[\rightWidth\ccwd]{#2}}%
   }%
}

\newcommand{\enroll}[1]{%
   \def\enroll@date{#1}%
   \strParse{#1}%
   \ifthenelse{\strParseFlag=1}{% unrecognized
      \ClassWarning{SDUSThesis}{Unrecognized date, use default.}%
      \edef\enroll@year{\default@enroll}%
      \edef\enroll@month{9}%
      \edef\enroll@day{3}%
   }{% else
      \edef\enroll@year{\theYear}%
      \edef\enroll@month{\theMonth}%
      \IfStrEq{\dateformat}{short}{% If short, day may be unused
         \edef\enroll@day{3}% use 3rd of the month
      }{% long, use the day value.
         \edef\enroll@day{\theDay}%
      }% end short test.
   }% end wrong
}
\newcommand{\field}[1]{%
   \def\input@field{#1}%
   \strDiv{\input@field}%
   \edef\fieldWidth{\expandonce{\thewide}}%
   \edef\fieldBreak{\expandonce{\lines}}%
   \ifthenelse{\lines=2}{%
      \edef\l@field{\expandonce{\lpart}}\edef\r@field{\expandonce{\rpart}}%
   }{%
      \edef\@field{\expandonce{\nospacestr}}%
   }% end ifthen
   \ifthenelse{\fieldWidth<6}{\def\rightWidth{6}}{\edef\rightWidth{\fieldWidth}}%
}

\newcommand{\defense}[1]{
   \def\defense@date{#1}%
   \strParse{#1}% Get the date value
   \ifthenelse{\strParseFlag=1}{% unrecognized
      \ClassWarning{SDUSThesis}{Unrecognized date, use default.}%
      \def\defense@year{\submit@year}%
      \def\defense@month{6}%
      \def\defense@day{17}%
   }{% else
      \edef\defense@year{\theYear}%
      \edef\defense@month{\theMonth}%
      \IfStrEq{\dateformat}{short}{% If short, day may be unused
         \def\defense@day{17}%
      }{% long, use the day value.
         \edef\defense@day{\theDay}%
      }% end short test.
   }% end wrong
}

\newcommand{\showMajor}{%
   \ifthenelse{\majorBreak=2}{% have line break
      \begin{minipage}[t]{\majorWidth\ccwd}
         \underline{\cexpand[\majorWidth\ccwd]{\l@major}}\\
         \underline{\cexpand[\majorWidth\ccwd]{\r@major}}
      \end{minipage}
   }{% only one line
      \underline{\cexpand[\majorWidth\ccwd]{\@major}}%
   }% end ifthen
}
\newcommand{\showField}{%
   \ifthenelse{\fieldBreak=2}{% have line break
      \begin{minipage}[t]{\rightWidth\ccwd}
         \underline{\cexpand[\rightWidth\ccwd]{\l@field}}\\
         \underline{\cexpand[\rightWidth\ccwd]{\r@field}}
      \end{minipage}
   }{% only one line
      \underline{\cexpand[\rightWidth\ccwd]{\@field}}%
   }% end ifthen
}

\newenvironment{zhAbstract}%
{\thispagestyle{headings}
\chaptermark{\zhAbstractName}
\begin{center}
\vspace*{1.5em}
\pdfbookmark[0]{\zhAbstractName}{zhAbstract}
{\songti\zihao{-2}\bfseries\ziju{1} \zhAbstractName}
\vspace{1.5em}
\end{center}
\par
}% before
{\newpage\thispagestyle{empty}\cleardoublepage}% after

\newcommand{\zhKeywords}[1]{%
\vspace{1.5em}%
{\bfseries \zhKeywordName{}：}#1%
}

\newenvironment{enAbstract}%
{\thispagestyle{headings}
\chaptermark{\enAbstractName}
\begin{center}
\vspace*{1.5em}
\pdfbookmark[0]{\enAbstractName}{enAbstract}
{\Large \bfseries \enAbstractName}
\vspace{1.5em}
\end{center}
% \bfseries
\par
}% before
{\newpage\thispagestyle{empty}\cleardoublepage}% after

\newcommand{\enKeywords}[1]{%
\vspace{1.5em}%
{\bfseries \enKeywordName{}: }#1%
}

%%%%%%%%%%%%%%%%%%% English Contents %%%%%%%%%%%%%%%%%%%
\newcommand\engcontentsname{Contents}
\newcommand\tableofengcontents{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\engcontentsname
        \@mkboth{%
           \MakeUppercase\engcontentsname}{\MakeUppercase\engcontentsname}}%
    \@starttoc{toe}% !!!!Define a new contents!!!!
    \if@restonecol\twocolumn\fi
    }
\newcommand\addengcontents[2]{%
    \addcontentsline{toe}{#1}{\protect\numberline{\csname the#1\endcsname}#2}}

\newcommand\echapter[1]{\addengcontents{chapter}{#1}}
\newcommand\esection[1]{\addengcontents{section}{#1}}
\newcommand\esubsection[1]{\addengcontents{subsection}{#1}}


\newcommand{\makecontents}{
\clearpage{
\pagestyle{headings}
\pdfbookmark[0]{\contentsname}{zhcontents}
\tableofcontents
\clearpage\thispagestyle{empty}\cleardoublepage
\pdfbookmark[0]{\engcontentsname}{encontents}
\tableofengcontents
\clearpage\thispagestyle{empty}\cleardoublepage
}
}

%%%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%
\newcommand{\stfrontmatter}{%
\frontmatter%
\loadgeometry{stBody}%
}
\newcommand{\stmainmatter}{%
\mainmatter%
% \pagestyle{fancy}
% \CTEXsetup[titleformat={\zihao{-3}\songti\bfseries}]{chapter}
}
\newcommand{\stbackmatter}{%
\backmatter%
}

\renewcommand{\today}{\the\year.\the\month.\the\day}
%%%%%%%%%%%%%%%%%% default settings: %%%%%%%%%%%%%%%%%%%%
\classNo{}
\secType{公开}
\UDC{}
\orgNo{10424}
\degree{Science}{硕士学位}
\major{对应专业名称}
\field{专业研究方向}
\supervisor[Supervisor Name]{导师姓名}
\ptitle{教授}{Prof.~}
\college{你的学院}{Input your College name here}

\date{\today}
\enroll{\default@enroll.9.3}
\defense{\submit@year.6.17}

\AtBeginDocument{\loadgeometry{stFront}}

\newcommand{\infoType}[1]{{\zihao{-4}\songti\bfseries{#1}}}
\newcommand{\zhHeadType}[1]{{\zihao{3}\kaishu\bfseries{#1}}}
\newcommand{\fillType}[1]{{\zihao{3}\songti\bfseries{#1}}}
%%%%%%%%%%%%%%%%%%%%%%% TitlePage %%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\makecover}[1]{
\thispagestyle{empty}
\pdfbookmark[-1]{\zh@title}{cover}
\begin{center}
\infoType{%
\expand[\tinfolen]{\classNoName}\connSep%
\underline{\cexpand[\tinfolen]{\@classNo}}%
\hfill%
\expand[\tinfolen]{\secTypeName}\connSep%
\underline{\cexpand[\tinfolen]{\@secType}}%
\\%
\cexpand[\tinfolen]{\UDCName}\connSep%
\underline{\cexpand[\tinfolen]{\@UDC}}%
\hfill%
\expand[\tinfolen]{\orgNoName}\connSep%
\underline{\cexpand[\tinfolen]{\@orgNo}}%
\\%
}

\vspace{6em}

{\ziju{.5} \zihao{-2} \songti \bfseries #1}\\[1em]
{\zihao{1} \heiti \bfseries \zh@title}\\[6em]
{\zihao{2} \songti \bfseries \cexpand[4em]{\zh@author}}
\vfill

{\zihao{-2}\songti\bfseries
\scalebox{0.8}[1]{\expand[6em]{\degreeLevelName}}\connSep%
\underline{\cexpand[4em]{\@degreeLevel}}%
\quad%
\scalebox{0.8}[1]{\expand[4em]{\majorName}}\connSep%
\showMajor%
\\[.5em]
\scalebox{0.8}[1]{\expand[6em]{\supervisorName}}\connSep%
\underline{\cexpand[4em]{\zh@supervisor}}%
\quad%
\scalebox{0.8}[1]{\expand[4em]{\profTitleName}}\connSep%
\underline{\cexpand[\majorWidth\ccwd]{\zh@ptitle}}%
}

\vspace{\stretch{2}}
{\ziju{1} \zihao{2} \songti \bfseries \schoolName} \\[.8em]
{\zihao{-2} \songti \bfseries \useDate{big}}
\end{center}
\newpage
\thispagestyle{empty}
\cleardoublepage
}

%%%%%%%%%%%%%%%%%%%%%%% TitlePage %%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\maketitle}{\makecover{\thesisType}}

%%%%%%%%%%%%%%%%%%%%%%% HeadPage %%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\makeflypage}{
\thispagestyle{empty}
\begin{center}
\begin{flushleft}
	\zhHeadType{论文题目：}
	\vspace{3.5em}
\end{flushleft}
	{ \zihao{2}\heiti \bfseries \zh@title}

\vspace{\stretch{1.5}}

\zhHeadType{\expand[4em]{\authorName}\connSep}%
\fillType{\underline{\cexpand[\majorWidth\ccwd]{\zh@author}}%
\quad}%
\zhHeadType{\expand[4em]{\enrollDate}\connSep}%
\fillType{\underline{\cexpand[\rightWidth\ccwd]{%
\convertDate{\enroll@year}{\enroll@month}{}%
}}}%
\\[1em]
\zhHeadType{\expand[4em]{\majorName}\connSep}%
\fillType{\showMajor%
\quad}%
\zhHeadType{\expand[4em]{\fieldName}\connSep}%
\fillType{\showField}%
\\[1em]
\zhHeadType{\expand[4em]{\superName}\connSep}%
\fillType{%
\begin{minipage}[t]{\majorWidth\ccwd}\supervisorList\end{minipage}%
\quad}% \underline{\cexpand[\majorWidth\ccwd]{\zh@supervisor}}%
\zhHeadType{\expand[4em]{\profTitleName}\connSep}%
\fillType{%
\begin{minipage}[t]{\rightWidth\ccwd}\personTitleList\end{minipage}%
}% \underline{\cexpand[\rightWidth\ccwd]{\zh@ptitle}}%
\\

\vfill
\begin{flushleft}
\zhHeadType{\submitDate\connSep}%
\fillType{\underline{\cexpand[7em]{\useDate{small}}}}%
\\[1em]%
\zhHeadType{\defenseDate\connSep}%
\fillType{\underline{\cexpand[7em]{%
\convertDate{\defense@year}{\defense@month}{}%
}}}%
\\[1em]%
\zhHeadType{\awardDate\connSep}%
\fillType{\underline{\cexpand[7em]{}}}%
\vspace{4em}
\end{flushleft}
\end{center}
\newpage
\thispagestyle{empty}
\cleardoublepage
% }

%%%%%%%%%%%%%%%%%%%%%% English %%%%%%%%%%%%%%%%%%%%%%%%
% \newcommand{\enhead}{
\thispagestyle{empty}
\begin{center}
	\bfseries
	\linespread{2}\selectfont
	{\Large \MakeUppercase{\en@title}}
	\vfill
	{\small A Dissertation submitted in fulfillment of
	the requirements of the degree of}
	\vfill
	{\Large \MakeUppercase{ master of \type@degree}}
	\vfill
	{\small from}
	\vfill
	{\large \schoolNameEn}
	\vfill
	{\small by}
	\vfill
	{\large \en@author}
	\\\vspace{\stretch{2}}
	{\large \superNameEn: \en@ptitle \en@supervisor}
	\\\vspace{\stretch{4}}
	{\large \en@college}\\
	{\large \useDate{old}}
\end{center}
\newpage
\thispagestyle{empty}
\cleardoublepage
}

%%%%%%%%%%%%%%%%%% Affirmation %%%%%%%%%%%%%%%%%%%%%%
\newcommand{\affirmation}{
\thispagestyle{empty}
\begin{center}
	\vspace*{1em}
	{\ziju{2}\songti\zihao{-2}\bfseries \affirmationName}
	\vspace*{2em}
\end{center}

{% \songti\zihao{-4} % default
本人呈交给\schoolName{}的这篇\@degreeLevel{}论文，%
除了所列参考文献和世所公认的文献外，%
全部是本人在导师指导下的研究成果。%
该论文资料尚没有呈交于其它任何学术机关作鉴定。%
}
\vfill
\begin{flushright}
	\expand[6em]{硕士生签名：}\hspace*{8em}% TODO, hard coded

	\expand[6em]{日期：}\hspace*{8em}
\end{flushright}
\vfill
\begin{center}
	\vspace*{2em}
	{\Large\bfseries \MakeUppercase{\affirmationNameEn}}
\end{center}

{\bfseries
I declare that this dissertation, submitted in fulfillment of the
requirements for the award of Master of Philosophy in \schoolNameEn{},
is wholly my own work unless referenced of acknowledge.
The document has not been submitted for qualification at any
other academic institute.
}
\vfill
\begin{flushright}
	\cexpand[6em]{\bfseries Signature:}\hspace*{8em}

	\cexpand[6em]{\bfseries Date:}\hspace*{8em}
\end{flushright}
\vspace{2em}
\newpage
\thispagestyle{empty}
\cleardoublepage
}

\endinput
% vim: set ts=4 sw=4 :

